<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true">
			<view class="item " v-for="(item, index) in dataList" :key="index">
				<view class="item-con flex-row items-center justify-between">
					<image src="/static/img/m2.png" mode="" class="item-icon"></image>
					<view class="fill" style="padding-left: 20rpx;">
						<view class="flex-row items-center justify-between">
							<text class="item-price">{{item.name}}</text>
							<view class="item-title">{{item.createDate | messageDate}}</view>
						</view>
						<view class="item-c" style="word-wrap: break-word;">{{item.content}}</view>
					</view>
				</view>
			</view>
		</s-pull-scroll>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>
<script>
export default {
	data() {
		return {
			dataList:[]
		};
	},
	onLoad() {
		this.refresh();
	},
	methods: {
		changeTabs(index) {
			this.current = index;
		},
		pullDown(pullScroll) {
			setTimeout(() => {
				this.loadData(pullScroll);
			}, 200);
		},
		async loadData(pullScroll) {
			const data = {
				uid: uni.getStorageSync('uid'),
				pageNo: pullScroll.page,
				pageSize: '10'
			};
			if (pullScroll.page == 1) this.dataList = [];
			const res = await this.$request('user/msg', data, { showLoading: true });
			if (res.result == 0) {
				this.dataList = this.dataList.concat(res.data.list);
				pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
			} else {
				this.$util.msg(res.resultNote);
			}
		}
	}
};
</script>
<style>
page {
	background: #ffffff;
}
</style>
<style scoped lang="scss">
.item-icon {
	width: 90rpx;
	height: 90rpx;
	border-radius: 50%;
}
.item {
	padding: 0 30rpx;
}
.item-con {
	padding: 30rpx 0;
	border-bottom: 1rpx solid rgba(218, 218, 218, 0.18);
}
.item-title {
	font-size: 22rpx;
	font-family: PingFang SC;
	font-weight: 500;
	color: #bababa;
}
.item-d {
	font-size: 28rpx;
	font-weight: bold;
	color: #000000;
}
.item-price {
	font-size: 30rpx;
	font-weight: 500;
	color: #333333;
}
.item-c {
	font-size: 24rpx;
	font-weight: 500;
	color: #999999;
	padding-top: 10rpx;
}
</style>
